Path gadget action

back to section start!

 
  The user typed a string into the path gadget, so we got to go and get the 
path, bother. 
 
  1dopath: 
  2  if pos(right(namestr,1),'/:') = 0 then 
  3    namestr = namestr'/' 
  4  if left(namestr,length(arcfile)) = arcfile then do 
  5    if namestr = arcfile'/'arcsubdir then 
  6      call delete('T:ArcDir.list'handle) 
  7    else 
  8      arcsubdir = substr(namestr,length(arcfile) + 2) 
  9    call arclist 
 10    end 
 11  else do 
 12    cuthere = pos('.LHA/',upper(namestr)) 
 13    if cuthere = 0 then 
 14      cuthere = pos('.LZH/',upper(namestr)) 
 15    if cuthere > 0 then 
 16      arctype = 'LHA' 
 17    else do 
 18      cuthere = pos('.LZX/',upper(namestr)) 
 19      if cuthere > 0 then 
 20        arctype = 'LZX' 
 21      end 
 22    if cuthere > 0 then do 
 23      call delete('T:ArcDir.list'handle) 
 24      arcfile = left(namestr,cuthere + 3) 
 25      arcsubdir = substr(namestr,cuthere + 5) 
 26      call arclist 
 27      end 
 28    else do 
 29      lister read handle '"'namestr'"' force 
 30      end 
 31    end 
 32  return 
 
Line: 
 1      Sub-routine label. 
 2 - 3  Check to see if the rightmost character of the path is a ':' or a 
        '/', if it wasn't then add a '/'. 
 4      We check to see if the leftmost part of the path matches our current 
        archive name. 
 5 - 6  The path equalled our current path, so we do the equivalent of a 
        ReRead.  Delete the current archive contents list... 
 7 - 8  Otherwise we set our current archive sub-directory to what was typed 
        in... 
 9 - 10 and call  arclist  to generate a lister display. 
11 - 21 These lines are checking to see if the path typed in was actually 
        another archive name and setting cuthere to greater than 0 
        if it was. 
22 - 27 If the path was another archive we delete the current archive 
        contents list, set arcfile to the name of the archive, set arcsubdir 
        to the sub-directory in the archive and call  arclist  to set up the 
        lister display for the new archive. 
28 - 30 It wasn't a path in the current archive, it wasn't a new archive, it 
        must be a real path - so we read it into the lister, this will kill 
        our handler and it will now be a normal lister. 
31      End of 'if left(namestr...'. 
32      Return to where we came from. 
 

DOpus PLUS - giving you that bit extra...